<?php
class Weibo_fans_model extends CI_Model
{
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    
    public function get_info_sql($sql)
    {
        $query=$this->db->query($sql);
        return $query->result_array();
    }
    public function get_info($uid=FALSE)    //读取信息
    {
        if($uid ===FALSE)
        {
            $query=$this->db->get('weibo_info');
            return $query->result_array();
        }
        $query=$this->db->get_where('weibo_info',array('uid'=>$uid));
        return $query->result_array();
    }
    public function create_info($uid,$screen_name,$img_url,$created_at,$text,$retweeted_uid,$retweeted_screen_name,$retweeted_created_at,$retweeted_txt)      //生成信息
    {
        $data=array(
            'id'=>'',
            'uid'=>$uid,
            'screen_name'=>$screen_name,
            'img_url'=>$img_url,
            'created_at'=>$created_at,
            'weibo_text'=>$text,
            'retweeted_uid'=>$retweeted_uid,
            'retweeted_screen_name'=>$retweeted_screen_name,
            'retweeted_created_at'=>$retweeted_created_at,
            'retweeted_txt'=>$retweeted_txt
        );
        return $this->db->insert('weibo_info',$data);
    }
}
?>
